#include <iostream>  
#include <vector>  
#include <algorithm>  
#include <cmath>  
#include <iomanip>
#define int long long
using namespace std;  
  
const double PI = 3.14159265358979323846;  
  
struct Circle {  
    int x, y, r;  
    double distance;  
  
    Circle(int _x, int _y, int _r) : x(_x), y(_y), r(_r) {  
        distance = sqrt(static_cast<double>(x * x + y * y));  
    }  
  
    bool containsOrigin() const {  
        return distance <= r;  
    }  
  
    double moveCost() const {  
        if (distance <= r) return 0; 
        return PI * r * r * (distance - r);  
    }  
};  
  
signed main() {  
    int n, k;  
    cin >> n >> k;  
  
    vector<Circle> circles;  
    for (int i = 0; i < n; ++i) {  
        int x, y, r;  
        cin >> x >> y >> r;  
        circles.emplace_back(x, y, r);  
    }  
  
    sort(circles.begin(), circles.end(), [](const Circle& a, const Circle& b) {  
        return a.distance < b.distance;  
    });  
  
    double totalCost = 0;  
    int countContainingOrigin = 0;  
  
 
    for (auto& circle : circles) {  
        if (circle.containsOrigin()) {  
            ++countContainingOrigin;  
            if (countContainingOrigin > k) {  
                totalCost += circle.moveCost();  
                break; 
            }  
        }  
    }  
  
  
    cout << fixed << setprecision(15) << totalCost << endl;  
  
    return 0;  
}